var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (e, a) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, e) {
              t.__proto__ = e;
            }) ||
          function (t, e) {
            for (var a in e)
              Object.prototype.hasOwnProperty.call(e, a) && (t[a] = e[a]);
          })(e, a);
      };
      return function (e, a) {
        function o() {
          this.constructor = e;
        }
        if ("function" != typeof a && null !== a)
          throw new TypeError(
            "Class extends value " + String(a) + " is not a constructor or null"
          );
        t(e, a),
          (e.prototype =
            null === a
              ? Object.create(a)
              : ((o.prototype = a.prototype), new o()));
      };
    })(),
  SlotmachineView = (function (t) {
    function e() {
      var e = t.call(this) || this;
      return (
        (e.textArr = []),
        (e.count = 0),
        (e.duration = 250),
        (e.delay = 300),
        (e.space = 300),
        (e.isGetRes = !1),
        e.btn_slot_close.on(Laya.Event.CLICK, e, e.onCloseSlotAction),
        e.btn_slot_yaojiang_start.on(
          Laya.Event.CLICK,
          e,
          e.onSlotYaoJiangAction
        ),
        e.btn_slot_yaojiang_start10.on(
          Laya.Event.CLICK,
          e,
          e.onSlotYaoJiangAction
        ),
        e.btn_zhongjiangmingdan.on(Laya.Event.CLICK, e, e.onLookMingDanActions),
        e.btn_slot_choujiang.on(
          Laya.Event.CLICK,
          e,
          e.onChouJiangMingDanActions
        ),
        e.btn_slot_shuoming.on(Laya.Event.CLICK, e, e.onSlotShuoMingActions),
        WebSocketService.addListener({
          caller: e,
          code: 5327,
          method: e.onLoadSlotResultActData,
        }),
        WebSocketService.addListener({
          caller: e,
          code: 5328,
          method: e.onLoadSlotResultActData,
        }),
        WebSocketService.addListener({
          caller: e,
          code: 5329,
          method: e.onLoadSlotResultActData,
        }),
        WebSocketService.addListener({
          caller: e,
          code: 5330,
          method: e.onLoadSlotResultActData,
        }),
        (e.slide_slot_sli.max = 500),
        e
      );
    }
    return (
      __extends(e, t),
      (e.openSlotView = function () {
        return (
          null == this.smView && (this.smView = new e()),
          this.smView.initUI(),
          this.smView
        );
      }),
      (e.prototype.initUI = function () {
        (this.label_slot_item1.alpha = 0.5),
          (this.label_slot_item2.alpha = 0.5),
          (this.label_slot_item3.alpha = 0.5),
          (this.label_slot_item4.alpha = 0.5),
          (this.label_slot_item5.alpha = 0.5),
          (this.label_slot_item6.alpha = 0.5),
          (this.label_slot_item7.alpha = 0.5),
          (this.label_slot_item8.alpha = 0.5),
          WebSocketService.send({ c: 5329, d: { roleId: Global.roleId } }),
          WebSocketService.send({ c: 5330, d: { roleId: Global.roleId } });
      }),
      (e.prototype.onSlotYaoJiangAction = function (t) {
        (this.btn_slot_yaojiang_start.disabled = !1),
          (this.btn_slot_yaojiang_start10.disabled = !1),
          (this.count = 0),
          (this.textArr = [
            "参与奖",
            "一等奖",
            "参与奖",
            "二等奖",
            "参与奖",
            "三等奖",
            "参与奖",
            "参与奖",
          ]),
          this.animationBingo(),
          this.rotateTextAnimation(),
          (this.isGetRes = !1),
          (this.slotRes = ""),
          "item_slot1" == t.target.name
            ? WebSocketService.send({
                c: 5327,
                d: { roleId: Global.roleId, num: 1 },
              })
            : "item_slot10" == t.target.name &&
              WebSocketService.send({
                c: 5327,
                d: { roleId: Global.roleId, num: 10 },
              });
      }),
      (e.prototype.onLookMingDanActions = function () {
        WebSocketService.send({ c: 5328, d: { roleId: Global.roleId } });
      }),
      (e.prototype.animationBingo = function () {
        (this.btn_slot_yaojiang_start.disabled = !0),
          (this.btn_slot_yaojiang_start10.disabled = !0);
      }),
      (e.prototype.rotateTextAnimation = function () {
        Laya.Tween.from(
          this.label_slot_item1,
          { alpha: 1 },
          this.duration,
          Laya.Ease.linearNone,
          Laya.Handler.create(this, this.rebackAction, [this.label_slot_item1]),
          this.delay
        ),
          Laya.Tween.from(
            this.label_slot_item2,
            { alpha: 1 },
            this.duration,
            Laya.Ease.linearNone,
            Laya.Handler.create(this, this.rebackAction, [
              this.label_slot_item2,
            ]),
            1 * this.delay + this.space
          ),
          Laya.Tween.from(
            this.label_slot_item3,
            { alpha: 1 },
            this.duration,
            Laya.Ease.linearNone,
            Laya.Handler.create(this, this.rebackAction, [
              this.label_slot_item3,
            ]),
            2 * this.delay + this.space
          ),
          Laya.Tween.from(
            this.label_slot_item4,
            { alpha: 1 },
            this.duration,
            Laya.Ease.linearNone,
            Laya.Handler.create(this, this.rebackAction, [
              this.label_slot_item4,
            ]),
            3 * this.delay + this.space
          ),
          Laya.Tween.from(
            this.label_slot_item5,
            { alpha: 1 },
            this.duration,
            Laya.Ease.linearNone,
            Laya.Handler.create(this, this.rebackAction, [
              this.label_slot_item5,
            ]),
            4 * this.delay + this.space
          ),
          Laya.Tween.from(
            this.label_slot_item6,
            { alpha: 1 },
            this.duration,
            Laya.Ease.linearNone,
            Laya.Handler.create(this, this.rebackAction, [
              this.label_slot_item6,
            ]),
            5 * this.delay + this.space
          ),
          Laya.Tween.from(
            this.label_slot_item7,
            { alpha: 1 },
            this.duration,
            Laya.Ease.linearNone,
            Laya.Handler.create(this, this.rebackAction, [
              this.label_slot_item7,
            ]),
            6 * this.delay + this.space
          ),
          Laya.Tween.from(
            this.label_slot_item8,
            { alpha: 1 },
            this.duration,
            Laya.Ease.linearNone,
            Laya.Handler.create(this, this.rebackAction, [
              this.label_slot_item8,
              "lastone",
            ]),
            2 * this.delay
          );
      }),
      (e.prototype.rebackAction = function (t, e) {
        (t.alpha = 0.5),
          this.count++,
          "lastone" == e &&
            (this.isGetRes && this.count >= 2 * this.textArr.length
              ? ((this.btn_slot_yaojiang_start.disabled = !1),
                (this.btn_slot_yaojiang_start10.disabled = !1),
                NormalDialog.showNormalDialog(
                  this.slotRes,
                  this,
                  this.noaction
                ))
              : this.rotateTextAnimation());
      }),
      (e.prototype.loopAnimation = function (t) {
        (this.label_slot_reward1.text = t), (this.label_slot_reward1.y = 163);
      }),
      (e.prototype.onLoadSlotResultActData = function (t) {
        if (
          (5327 == t.act_id &&
            ((this.isGetRes = !0),
            (this.slotRes = t.msg),
            WebSocketService.send({ c: 5329, d: { roleId: Global.roleId } }),
            WebSocketService.send({ c: 5330, d: { roleId: Global.roleId } })),
          5328 == t.act_id)
        )
          if (0 == t.code) {
            var e = {
              type: "ZhongJiangMingDan",
              data: t.data,
              title: "中奖名单",
            };
            AXListDataDialog.showListDataView(e);
          } else ToastView.toastView(t.msg);
        if (5329 == t.act_id) {
          if (t.msg) {
            var a = 500 - t.msg.match(/\d+/g);
            (this.slide_slot_sli.value = a),
              (this.label_slot_res_num.text = a + "/500");
          }
          this.isCheckCanLingHongBao && ToastView.toastView(t.msg);
        }
        5330 == t.act_id &&
          t.data &&
          (this.label_slot_reward1.text = "奖池\n" + t.data);
      }),
      (e.prototype.noaction = function () {}),
      (e.prototype.onChouJiangMingDanActions = function () {
        (this.isCheckCanLingHongBao = !0),
          WebSocketService.send({ c: 5329, d: { roleId: Global.roleId } });
      }),
      (e.prototype.onSlotShuoMingActions = function () {
        var t = RulesView.showCaslRuleView("choujiangshuoming");
        (t.y = 0), Laya.stage.addChild(t);
      }),
      (e.prototype.onCloseSlotAction = function () {
        this.removeSelf();
      }),
      e
    );
  })(ui.common.SlotmachineViewUI);
